package cn.script.app.bean;

import cn.script.call_api.OutLogApi;
import javafx.application.Platform;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import jdk.nashorn.internal.ir.annotations.Ignore;

public class LogOutApi {

    private ObservableList<LogInfo> logs = FXCollections.observableArrayList();

    @Ignore
    private OutLogApi outLogApi = val -> {
        Platform.runLater(() -> {
            try {
                if (this.logs.size() > 25) {
                    this.logs.clear();
                }
                this.logs.add(new LogInfo(val));
            } catch (Exception e) {
                e.printStackTrace();
            }

        });
    };

    public ObservableList<LogInfo> getLogs() {
        return this.logs;
    }

    public OutLogApi getOutLogApi() {
        return this.outLogApi;
    }
}
